/**
* Created by admin on 18-4-7.
*/
<template>
  <section class="orderBox">

    <el-row>
      <div class="one-title">图片资料</div>
      <div class="cardImg" v-for="(item,index) in fileList">
        <ml-photo-box ref='photoBox'></ml-photo-box>
        <img :src="item.url" @click.stop="attachmentUrl(fileList[0])"><br>{{item.name}}
      </div>
    </el-row>

    <el-row>
      <div class="one-title">文件资料</div>
      <el-table :data="fileData" width="100%"  @row-click="rowClick" size="large">
        <el-table-column type="index" label="序号" width="200" ></el-table-column>
        <el-table-column prop="name"  label="文件名称"></el-table-column>
        <el-table-column label="操作" prop="remark">
          <template scope="scope">
            <el-button size="small" @click="downLoadFile(scope.row)" type="success">下载</el-button>
          </template>
        </el-table-column>
      </el-table>
    </el-row>

    <div class="divid-line"></div>

    <el-form :inline="true" :model="tableData" class="toolbar">
      <el-row>
        <el-form-item label="审核结果">
          <el-select v-model="tableData.result" placeholder="请选择" clearable :disabled="seenOrNot">
            <el-option v-for="item in result" :label="item.name" :key="item.code" :value="item.code"></el-option>
          </el-select>
        </el-form-item>
      </el-row>
      <el-row>
        <el-form-item label="审核意见">
          <el-input type="textarea" v-model="tableData.remark" :rows="5" style="width: 500px;" :disabled="seenOrNot"></el-input>
        </el-form-item>
      </el-row>

      <el-col :offset="2">
        <el-form-item>
          <el-button @click="submit" type="success" :disabled="seenOrNot">提交意见</el-button>
        </el-form-item>
      </el-col>
    </el-form>
  </section>

</template>
<script>

  import mlPhotoBox from '../../components/_photoBox.vue'
  import DataUtil from '../../common/dataUtil'
  import ElForm from "../../../node_modules/element-ui/packages/form/src/form";
  import ElFormItem from "../../../node_modules/element-ui/packages/form/src/form-item";
  import ElCol from "element-ui/packages/col/src/col";
  export default {
    components: {
      ElCol,
      mlPhotoBox,
      ElFormItem,
      ElForm},
    data() {
      return {
        dialogImageUrl: '',
        dialogVisible: false,
        upLoadData: {
          userId: DataUtil.id()
        },
        userId:'',
        id:'',
        type:'',
        fileName:"",
        fileList:[

        ],
        fileData:[],
        seenOrNot: false,
        tableData:{result:'', remark: ''},
        result:[{
            code: 1,
          name: '通过'
        },{
            code:2,
          name: '未通过'
        }]
      };
    },
    methods: {

      attachmentUrl(item){
        if(item.url){
          let _photoList = [
            item.url
          ];
          this.$refs.photoBox.show(_photoList)
        }
      },
      getAllCheckData() {
        this.$http.post('check/getAllOrginzeData', {userId: this.userId, type: this.type, fileType: 1}).then(response => {
          if (response.body.code == 1) {
            this.fileList = response.body.data;
          }
        });
        this.$http.post('check/getAllOrginzeData', {userId: this.userId, type: this.type, fileType: 2}).then(response => {
          if (response.body.code == 1) {
            this.fileData = response.body.data;
          }
        });
        this.$http.post('schoolCheck/getCheckDataDetail', {id: this.id}).then(response => {
          if (response.body.code == 1) {
            this.tableData = response.body.data;
            if (this.tableData.result == 0) {
                this.tableData.result = '';
            }
            if (response.body.data.result != 0 || response.body.data.remark != '') {
                this.seenOrNot = true;
            }
          }
        })
      },
      downLoadFile(row) {
          window.open('http://localhost:8089/api/check/getDataSource?id=' + row.id)
//        this.$http.get("http://localhost:8089/check/getDataSource",{id:row.id});
      },
      submit() {

          if (this.tableData.remark == '' &&
            this.tableData.result == '') {
              this.$message.error('请选择审核结果或者填写意见!');
              return ;
          }
        var _data = {
          remark: this.tableData.remark,
          result: this.tableData.result,
          id: this.id,
          userId: this.userId,
        };
          this.$http.post('schoolCheck/updateCheckData', _data).then(response => {
             if (response.body.code == 1) {
               window.close();
               window.open('#/DataCheck');
            } else {
                 this.$message.error(response.body.message);
             }

          });

      }
    },
    mounted() {

      this.id = this.$route.query['id']||'';
      this.userId = this.$route.query['userId']||'';
      this.type = this.$route.query['type']|| '';
      this.getAllCheckData();

    }
  }

</script>

<style>
  .reviewTable {
    width: 80%;
    border-spacing: 0;
    border: 1px solid gray;
    margin: 20px auto;
  }
  .reviewTable td {
    text-align: center;
    border: 1px solid gray;
    height: 40px;
    line-height: 40px;

    width: 50%;
    word-wrap:break-word;
  }
  .videos {
    width: 80%;
    margin: 20px auto;
  }
  .cardImg {
    width: 40%;
    height: 300px;
    overflow: hidden;
    margin: 1.5%;
    float: left;
    text-align: center;
  }
  /*.faceCheck .faceImg img {*/
  /*margin: 0 auto;*/
  /*display: block;*/
  /*width: 90%;*/
  /*height: 90%;*/
  /*}*/
  /*侧边框布局*/
  .containers {
    width: 100%;
    /*height: 400px;*/
    display: flex;

  }
  .containers .asides {
    flex: 6;

  }
  .containers .mains {
    flex: 4;
    margin-left: 40px;
  }
  .other_remark {
    width: 100%;
  }
  .mains .smallRemark {
    width: 100%;
  }
  .asides table {
    border-spacing: 0;
    border: 1px solid #A9A9A9 ;
    border-radius: 2px;
  }
  .asides table td {
    border: .5px solid #efefef;
    word-wrap:break-word;
    line-height: 20px;
    padding: 5px;
  }
  table td img {
    width: 100%;
  }
  .aside_title {
    font-weight: 400;
    line-height: 40px;
    font-size: 16px;
  }
  .question_radio {
    padding-bottom: 30px;
    margin: 5px 10px;
  }
  .question_radio .radio_box {
    /*margin-bottom: -30px;*/
    line-height: 20px;
    float: right;
  }
  .addreBook {
    text-align: center;
    width: 40px;
  }
  /* 标题 */
  .main-title{
    font-size: 22px;
    margin-top: -15px;
    margin-bottom: 15px;
  }
  .one-title{
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 7px;
  }
  .two-title{
    font-size: 13px;
    color: #888;
    margin: 10px 0
  }
  .subtitle{
    font-size: 13px;
    color: #888;
  }
  .orderBox .el-row {
    margin: 8px 30px;
  }
  .orderBox .el-col span{
    margin-right: 10px;
  }
  .orderBox .el-button span,.orderBox .el-tag span{
    margin-right: 0;
  }
  .orderBox .box-card .el-button{
    margin-right: 5px;
  }
  .orderBox .grid-content {
    line-height: 28px;
  }

  .divid-line{
    height: 10px;
    background: #f1f2f7;
  }
  /*借款信息*/
  .loanDetail{
    margin: 0 30px 15px;
    width: 94%;
    max-height:250px;
  }
  /*依图识别*/
  .yituInfo{
    display: block;
    text-align: center;
    margin-top: 10px;
  }
  /*征信*/
  .orderBox .box-card{
    height: 225px;
  }
  .JXLBox{
    border: 1px solid #ccc;
    padding: 10px
  }
  .JXLBox div{
    padding: 5px;
  }

  .orderBox .el-table .info-row {
    background: #e2f0e4;
  }

  .orderBox .el-table .red-row{
    background: #F33;
  }
  .redInfo{
    color: #F33;
  }

  .line-height .el-col{
    margin-bottom: 10px;
  }
  .faceCheck {
    margin: 0 auto;
    overflow: hidden;
  }
  .faceCheck .faceImg{
    width: 45%;
    height: 350px;
    overflow: hidden;
    margin: 1.5%;
    float: left;
    text-align: center;
  }
  .faceCheck .faceImg img {
    margin: 0 auto;
    display: block;
    width: 90%;
    height: 90%;
    /*    border: .5px solid #F1F2F7;
    border-radius: 5px;*/
  }
  .faceImgTop img{
    margin: 0 auto;
    height: 200px;
    display: block;
    max-height: 100%;
    max-width: 100%;
    min-width: 65%;
    min-height: 65%;
    border: .5px solid #F1F2F7;
    border-radius: 5px;
  }
  .faceImgBottom img{
    margin: 0 auto;
    display: block;
    height: 300px;
    min-width: 80%;
    min-height: 80%;
    border: .5px solid #F1F2F7;
    border-radius: 5px;
  }
  table td img {
    width: 100%;
  }
  .faceImgTop .handleImg {
    width: 40%;
    transform: rotate(-90deg);
    -webkit-transform: rotate(-90deg);
  }
  .divid-line{
    height: 10px;
    background: #f1f2f7;
  }
   .faceImg{
    width: 25%;
    height: 250px;
    overflow: hidden;
    margin: 1.5%;

    text-align: center;
  }
  .faceCheck .faceImg img {
    margin: 0 auto;
    display: block;
    width: 90%;
    height: 90%;
    /*    border: .5px solid #F1F2F7;
    border-radius: 5px;*/
  }
</style>
